<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
cfc('core')->checklogin();
$this->checkmanage();
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_SESSION['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'managerid'=>$_SESSION['uid']);	
    //$fields=array('id','ordersn','name','mobile','driver_id','mid','createtime','status','price','price1','start_seat','dest_seat','cuid');
    $orderby='createtime desc';
	$total='';
	$return['list']=pdo_getslice('jy_smallquan_manager_order',$params,array($pindex,$psize),$total,$fields,'',$orderby);	
	
	if($return['list']){
		foreach($return['list'] as &$v){
			$member=pdo_get('core_members',array('id'=>$v['mid']),array('mobile','realname'));
			$v['realname']=$member['realname'];
			$v['mobile']=$member['mobile'];
			$v['createtime']=date('Y-m-d H:i:s',$v['createtime']);
		}
	}
	$return['type']=array('1'=>'送水','2'=>'维修','3'=>'帮忙');
	$return['status']=array('0'=>'待服务','1'=>'正在处理','2'=>'已完成');
	exi($return);
}
if($_RQ['op']=='done'){
	$id=$_RQ['id'];
	if(!$id){
		exi('参数错误','error');
	}
	
	pdo_update('jy_smallquan_manager_order',array('status'=>2),array('id'=>$id));
	exi('已完成','','/manageorder/');
}